package servlets;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class OrderProductTableList {
    public static OrderProductTable findOrder(Integer id){
        return (OrderProductTable)ordersProductTable.get(id);
    }

    public static OrderProductTable[] getOrderProductTable()
    {
        List<OrderProductTable> list = new ArrayList<OrderProductTable>(ordersProductTable.values());
        return list.toArray(new OrderProductTable[list.size()]);
    }

    public static Integer addOrderProductTable(OrderProductTable orderProductTable){
        Integer id = ordersProductTable.size() + 1;
        orderProductTable.setId(id);

        ordersProductTable.put(orderProductTable.getId(),orderProductTable);

        return id;
    }
    private static Map ordersProductTable = new HashMap();
}

/*package servlets;

import java.util.ArrayList;

public class OrderList  {
    public static Order takeOrder(){
        return orders.size() > 0 ? (Order)orders.get(orders.size() - 1) : null;
    }
    public static boolean putOrder(Order order){
        boolean result = false;
        
        orders.add(order);
        result = true;
        
        return result;
    }
    
    public static int elementCount(){
    	return orders.size();
    }
    
    private static ArrayList orders = new ArrayList();
}*/